<!--  -->
<template>
      <div class="task">
                        <template v-if="props.taskList && props.taskList.length > 0">
                            <div v-for="item in props.taskList" class="task-item" :style="{top:item.top,height: item.height }"
                                :key="item.id">
                                {{ item.serviceName }}
                                {{ formatTime(item.startTime) }} -
                                {{ formatTime(item.endTime) }}
                            </div>
                        </template>

                         <div class="add-task">
                            <el-button type="danger" link>+ 添加任务</el-button>
                         </div>
                    </div>
</template>

<script lang='ts' setup>
import { dayjs } from 'element-plus';
import { reactive,toRefs,ref,onMounted,defineProps} from 'vue'
const props = defineProps({
    taskList:Array<any>
})

const formatTime = (time:string) => {
    return dayjs(dayjs().format("YYYY-MM-DD")+" "+time).format('H:m');
}


</script>
<style scoped lang="less">
.task {
    height: 60px;
    width: 100%;
 
    position: relative;
    

    &:hover{
        
       .add-task{
        display: flex;
       }
    }

    .add-task{
        display: none;
        position: absolute;
        width: 100%;
        height: 100%;
        z-index: 999;
     
        justify-content: center;
        align-items: center;
    
    }

    .task-item {
        width: 100%;
        height: 120px;
        position: absolute;
        top: 0;
        left: 0;
        background: skyblue;
        z-index: 99;
        justify-content: center;
        display: flex;
        align-items: center;
    }
}
</style>